<!--
 * @Author: vaseBox 994279430@qq.com
 * @Date: 2025-04-21 01:25:08
 * @LastEditors: vaseBox 994279430@qq.com
 * @LastEditTime: 2025-04-21 15:30:26
 * @FilePath: /main-vite-ts/src/components/common/header.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <header class="header-box" :class="[pageName]">
    <div class="logo-box border">
      <img src="../assets/logo.png" alt="Logo" />
      <div>工作台</div>
    </div>
    <div class="menu-box">
      <template v-for="(item, index) in 5" :key="index">
        <div class="menu-item border">
          <img src="../assets/logo.png" alt="Logo" />
        </div>
      </template>
      <div class="menu-item avatar" @click="router.push('/login')">
        <!-- <img src="../assets/logo.png" alt="Logo" /> -->
      </div>
    </div>
  </header>
</template>

<script setup lang="ts" name="commonHeader">
import { computed } from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
// 这里可以添加你的逻辑代码
const pageName = computed(() => route.name || "home");
</script>

<style scoped lang="scss">
.header-box {
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100vw;
  height: 3.75rem;
  background-color: var(--c-bg);
  padding: 0 1.4rem;
  text-align: center;
  font-size: 1.5rem;
  border-bottom: 0.0625rem solid var(--hd-shadow);
  box-shadow: 0rem 0.25rem 0.63rem 0rem var(--hd-shadow);
  z-index: 1000;
  position: relative;

  .logo-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    color: #333;
    :hover {
      cursor: pointer;
    }
    img {
      width: 2rem;
      height: 2rem;
    }
    div {
      width: 6.19rem;
      height: 1.75rem;
      font-family: PingFangSC-Medium, PingFangSC-Medium;
      font-weight: 400;
      font-size: 1.25rem;
      color: #1d2129;
      line-height: 1.75rem;
      text-align: left;
      text-transform: none;
    }
  }

  .menu-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    color: #333;

    .menu-item {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      width: 2rem;
      height: 2rem;
      border-radius: 50%;

      &.avatar {
        width: 2.5rem;
        height: 2.5rem;
        background-color: #4080ff;
      }

      img {
        width: 100%;
        height: 100%;
        display: block;
        border-radius: 50%;
      }
      div {
        width: 6.19rem;
        height: 1.75rem;
        font-family: PingFangSC-Medium, PingFangSC-Medium;
        font-weight: 400;
        font-size: 1.25rem;
        color: #1d2129;
        line-height: 1.75rem;
        text-align: left;
        text-transform: none;
      }
    }
    .menu-item:hover {
      cursor: pointer;
    }
    .menu-item:hover img {
      background-color: #e0e0e0;
    }
  }
}
</style>
